package com.ligongmusic.view;

import android.app.Activity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;

import com.ligongmusic.R;

public class TopManager {
	private static TopManager topManager;
	private ImageView back;
	private TextView title;
	
	private TopManager(Activity context){
		initView(context);
	}
	
	private void initView(Activity context) {
		back = (ImageView) context.findViewById(R.id.iv_back);
		title = (TextView) context.findViewById(R.id.tv_title);
	}

	public static TopManager getTopManager(Activity context){
//		if(topManager == null)
			topManager = new TopManager(context);
		return topManager;
	}
	
	/**
	 * 改变标题状态
	 */
	public void showTop(boolean showBack, String titleContent, OnClickListener listener){
		back.setVisibility(showBack ? View.VISIBLE : View.GONE);
		back.setOnClickListener(listener);
		title.setText(titleContent);
	}
	
}